#!usr/bin/env python3
from PyQt5.QtWidgets import (QWidget,QGridLayout,QHBoxLayout,
                            QLabel,QLineEdit,QPushButton,QFileDialog,
                            QCheckBox,QTextEdit,QComboBox
                            )

from PyQt5.QtCore import Qt

class HeadLabel(QWidget):
    def __init__(self,labelText:str="标签",holderText:str="请输入"):
        super().__init__()
        layout = QHBoxLayout()
        self.setLayout(layout)
        layout.setAlignment(Qt.AlignTop)

        self.label = QLabel()
        self.label.setText(labelText)
        layout.addWidget(self.label)

        self.input = QLineEdit(self)
        layout.addWidget(self.input)
        self.input.setPlaceholderText(holderText)

        self.__updatePos()

    def setLabelText(self,text):
        self.label.setText(text)
        self.__updatePos()
    def setInputText(self,text):
        self.input.setText(text)
        self.__updatePos()
    def getInputText(self):
        return self.input.text()

    def __updatePos(self):
        self.label.move(0,0)
        self.input.move(self.label.x()+self.label.width(),0)